<?php
$this->title = "Groups";
$this->headTitle($this->title);
?>	

		
		<!-- start content -->
		<div id="viewgrp_inside" class="content">
			<div id="InnerMenu">
				<ul>
					<li>
						<a href="<?php echo $this->url(array('controller'=>'Search','action'=>'index'));?>">
						Search groups</a>
					</li>
					<li>
						<a href="<?php echo $this->url(array('controller'=>'Group','action'=>'index'));?>">
						Back to Groups</a>
					</li>
				</ul>
				<p>&nbsp;</p> 
				
			</div>
				<?php if ($this->flag_view == 0){?>
						<p>You are not a member of this group. You can join by clicking on the "Join button"</p>
						<div id="Join_Group">
							<form id="frm_JoinGroup" method="post">
								<input type="submit" id="btn_GroupJoin" name="btn_GroupJoin" value="Join">
							</form>
						</div>
				<?php }else{?>	
						<div id="Leave_Group">
							<form id="frm_Leave_Group" method="post">
								<input type="submit" id="btn_GroupLeave" name="btn_GroupLeave" value="LeaveGroup">
							</form>
						</div>
				<div id="viewGroup_tab">
						<ul>
							<li><a href="#viewGroup_tab-posts">Group posts</a></li>
							<li><a href="#viewGroup_tab-info">Info</a></li>							
						</ul>
					<div id="viewGroup_tab-posts" class="content">
						<form id="form_GropPost" name="form_GropPost" method="post">
							
							<label for="lbl_GropPost" id="lbl_GropPost" >Post a message:</label><br><br>												
							<textarea id="txt_GroupPost" name="txt_GroupPost" rows="3" cols="49"></textarea><br>							
							<input type="submit" id="btn_GroupPostSubmit" name="btn_GroupPostSubmit" value="Post">
						</form>
						<br><br>
						<?php if ($this->posts != null) { ?>
				
							<table title="tbl_GroupPosts" id="hor-minimalist-a">
								<tr>
									<th>Message</th>
									<th>Time</th>
									<th>User</th>
									<th>&nbsp;</th>					
								</tr>
							<?php foreach($this->posts as $post) : ?>
								<tr>
									<td> 
										<?php echo $post['Text'];  ?> 
									</td>
									<td>
										<?php
											$time = new Zend_Date($post['DatePost']);																		
											$DatePost=$time->toString("HH:mm:ss dd-MM-YYYY");									
											echo $DatePost;
										?>
									</td>
									<td><?php echo $post['FirstName'] . " " . $post['LastName'];?></td>
									<td></td>
								</tr>
						<?php endforeach; }?>				
						</table>
						
					</div>
					<div id="viewGroup_tab-info" class="content">
						<label><b>Info:</b></label>					
						<p id="groupInfo"><?php echo $this->escape($this->group['Info']); ?></p>
						<label><b>Description:</b></label>
						<p id="groupDescription"><?php echo $this->escape($this->group['Description']); ?></p>
					</div>
				</div>
				<?php }?>
			
			<br />	
			
		</div>
		
		<!-- end content -->
